package com.nmh.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDateTime;
@ApiModel(value = "用户类")
@Data
public class User implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(type= IdType.AUTO)
    @ApiModelProperty(value = "用户唯一标识")
    private Long userId;

    @ApiModelProperty(value = "用户名")
    private String userName;

//    @NotBlank(message="密码不能为空")
    @Length(max=10,message="密码最大长度为10")
    @ApiModelProperty(value = "用户密码")
    private String userPassword;

    @ApiModelProperty(value = "用户状态")
    private Integer userStates;


    @NotBlank(message = "账号不能为空")
    @Length(max = 10,message = "账号长度最大为10位")
    @ApiModelProperty(value = "用户账号")
    private String userAccount;

    @Pattern(regexp = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(17[013678])|(18[0,5-9]))\\d{8}$",message = "手机号码不合法")
    @ApiModelProperty(value = "用户电话")
    private String userPhone;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "用户创建时间")
    private LocalDateTime createTime;

    @TableField(fill=FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "用户修改时间")
    private LocalDateTime updateTime;
}
